import 'package:dart_date/dart_date.dart';
import 'package:get/get.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:yt_devops/utils/constants/time_formated.dart';
import 'package:yt_devops/utils/enums.dart';
import 'package:yt_devops/utils/func_utils.dart';

import '../components/log_utils.dart';
import '../resources/str_res_keys.dart';

class Formates {
  static String onlineStatus(int? status) {
    var connect = $enumDecodeNullable<ConnectStatusType, int>(
        $ConnectStatusTypeEnumMap, status);
    return connect?.label ?? '--';
  }

  static String onlineStatus1(int? status) {
    switch (status) {
      case 0:
        return ResKey.onLine.tr;
      case 1:
        return ResKey.offLine.tr;
      case 2:
        return ResKey.notConfigured.tr;
      default:
        return '--';
    }
  }

  static String communicateFormat(int status) {
    final map = {
      0: ResKey.normal.tr,
      1: ResKey.thingsDisconnection.tr,
    };
    return map[status] ?? '';
  }

  static String outputFormat(int status) {
    final map = {
      0: ResKey.thingsCease.tr,
      1: ResKey.thingsOutput.tr //输出,
    };
    return map[status] ?? '';
  }

  static String modelFormat(int status) {
    var map = {
      0: ResKey.thingsHandMovement.tr, //'手动',
      1: ResKey.thingsAutomatic.tr //  '自动',
    };
    return map[status] ?? '';
  }

  static String runFormat(int status) {
    var map = {
      0: ResKey.thingsStandby.tr, //'待机',
      1: ResKey.thingsRun.tr, //运行',
    };
    return map[status] ?? '';
  }

  static String singleFormat(int status) {
    final map = {
      0: ResKey.thingsBreak.tr, // 断开,
      1: ResKey.normal.tr,
    };
    return map[status] ?? '';
  }

  static String singleSelfDevelopFormat(int status) {
    var map = {
      0: ResKey.thingsEffective.tr, // '有效',
      1: ResKey.thingsBreak.tr, // 断开,
    };
    return map[status] ?? '';
  }

  static String pankFanAlarmFormat(value) {
    int val = -1;
    if (value is String) {
      var valueArr = FuncUtils.strToArray(value);
      if (valueArr.isNotEmpty) {
        val = valueArr[0];
      }
    } else if (value is int) {
      val = value;
    }

    final map = {
      0: {'text': ResKey.normal.tr, 'color': 'cl-success'},
      // 1: {'text': 'BMU1风扇故障', 'color': 'cl-error'},
      // 2: {'text': 'BMU2风扇故障', 'color': 'cl-error'},
      // 3: {'text': 'BMU3风扇故障', 'color': 'cl-error'},
      // 4: {'text': 'BMU4风扇故障', 'color': 'cl-error'},
      // 5: {'text': 'BMU5风扇故障', 'color': 'cl-error'},
      // 6: {'text': 'BMU6风扇故障', 'color': 'cl-error'},
      // 7: {'text': 'BMU7风扇故障', 'color': 'cl-error'},
      // 8: {'text': 'BMU8风扇故障', 'color': 'cl-error'},
      // 9: {'text': 'BMU9风扇故障', 'color': 'cl-error'},
      // 10: {'text': 'BMU10风扇故障', 'color': 'cl-error'},
    };
    var result = val == 0 ? ResKey.normal.tr : ResKey.alarm.tr;

    return result;
  }

  static String contactorFormat(value) {
    var valueArr = [];
    if (value is String) {
      valueArr = FuncUtils.strToArray(value);
    } else {
      valueArr = [value];
    }
    var map = {
      0: ResKey.thingsBreak.tr, // 断开,
      // 1: '主接触器闭合',
      // 2: '预充接触器闭合',
      // 5: '直流断路器闭合',
      // 6: '交流断路器闭合',
      // 7: '门禁闭合',
    };
    var result = valueArr.isNotEmpty
        ? valueArr[0] == 0
            ? map[valueArr[0]]
            : ResKey.thingsClose.tr //'闭合'
        : '';

    return result!;
  }

  static String externalFaultFormat(value) {
    var valueArr = [];
    if (value is String) {
      valueArr = FuncUtils.strToArray(value);
    } else {
      valueArr = [value];
    }
    final map = {
      0: {'text': ResKey.normal.tr, 'color': 'cl-success'},
      // 1: {'text': 'BMU硬件故障', 'color': 'cl-error'},
      // 2: {'text': 'BCU硬件故障', 'color': 'cl-error'},
      // 3: {'text': '熔断器故障', 'color': 'cl-error'},
      // 4: {'text': '接触器粘连故障', 'color': 'cl-error'},
      // 5: {'text': 'BMU通信故障', 'color': 'cl-error'},
      // 6: {'text': 'BAU通信故障', 'color': 'cl-error'},
      // 7: {'text': '电流传感器故障', 'color': 'cl-error'},
      // 8: {'text': '绝缘监测设备故障', 'color': 'cl-error'},
      // 9: {'text': '隔开开关异常断开', 'color': 'cl-error'},
      // 10: {'text': 'NTC故障', 'color': 'cl-error'},
      // 11: {'text': 'PCS通信故障', 'color': 'cl-error'},
      // 12: {'text': '急停信号', 'color': 'cl-error'},
      // 13: {'text': '水浸信号', 'color': 'cl-error'},
      // 14: {'text': '气溶胶信号', 'color': 'cl-error'},
      // 15: {'text': '交流防雷器故障', 'color': 'cl-error'},
    };
    var result = valueArr.isNotEmpty
        ? valueArr[0] == 0
            ? map[valueArr[0]]!['text']
            : ResKey.alarm.tr
        : '';

    return result!;
  }

  static String fault1Format(value) {
    var valueArr = FuncUtils.strToArray(value);
    final map = {
      0: {'text': ResKey.normal.tr, 'color': 'cl-success'},
      // 1: {'text': '总电压过压一级报警', 'color': 'cl-error'},
      // 2: {'text': '总电压欠压一级报警', 'color': 'cl-error'},
      // 3: {'text': '单体过压一级报警', 'color': 'cl-error'},
      // 4: {'text': '单体欠压一级报警', 'color': 'cl-error'},
      // 5: {'text': '放电电流过大一级报警', 'color': 'cl-error'},
      // 6: {'text': '充电电流过大一级报警', 'color': 'cl-error'},
      // 7: {'text': '放电电池过温一级报警', 'color': 'cl-error'},
      // 8: {'text': '放电电池欠温一级报警', 'color': 'cl-error'},
      // 9: {'text': '充电电池过温一级报警', 'color': 'cl-error'},
      // 10: {'text': '充电电池欠温一级报警', 'color': 'cl-error'},
      // 11: {'text': '绝缘阻值过低一级报警', 'color': 'cl-error'},
      // 12: {'text': '极柱温度过高一级报警', 'color': 'cl-error'},
      // 13: {'text': '高压箱连接器温度过高一级报警', 'color': 'cl-error'},
      // 14: {'text': '单体压差一级报警', 'color': 'cl-error'},
      // 15: {'text': '单体温差一级报警', 'color': 'cl-error'},
      // 16: {'text': 'SOC低一级报警', 'color': 'cl-error'},
    };
    var result = valueArr.isNotEmpty
        ? valueArr[0] == 0
            ? map[valueArr[0]]!['text']
            : ResKey.alarm.tr
        : '';

    return result!;
  }

  static String fault2Format(String value) {
    var valueArr = FuncUtils.strToArray(value);
    final map = {
      0: {'text': ResKey.normal.tr, 'color': 'cl-success'},
      // 1: {'text': '总电压过压二级报警', 'color': 'cl-error'},
      // 2: {'text': '总电压欠压二级报警', 'color': 'cl-error'},
      // 3: {'text': '单体过压二级报警', 'color': 'cl-error'},
      // 4: {'text': '单体欠压二级报警', 'color': 'cl-error'},
      // 5: {'text': '放电电流过大二级报警', 'color': 'cl-error'},
      // 6: {'text': '充电电流过大二级报警', 'color': 'cl-error'},
      // 7: {'text': '放电电池过温二级报警', 'color': 'cl-error'},
      // 8: {'text': '放电电池欠温二级报警', 'color': 'cl-error'},
      // 9: {'text': '充电电池过温二级报警', 'color': 'cl-error'},
      // 10: {'text': '充电电池欠温二级报警', 'color': 'cl-error'},
      // 11: {'text': '绝缘阻值过低二级报警', 'color': 'cl-error'},
      // 12: {'text': '极柱温度过高二级报警', 'color': 'cl-error'},
      // 13: {'text': '高压箱连接器温度过高二级报警', 'color': 'cl-error'},
      // 14: {'text': '单体压差二级报警', 'color': 'cl-error'},
      // 15: {'text': '单体温差二级报警', 'color': 'cl-error'},
      // 16: {'text': 'SOC低二级报警', 'color': 'cl-error'},
    };
    var result = valueArr.isNotEmpty
        ? valueArr[0] == 0
            ? map[valueArr[0]]!['text']
            : ResKey.alarm.tr
        : '';

    return result!;
  }

  static String fault3Format(String value) {
    var valueArr = FuncUtils.strToArray(value);
    final map = {
      0: {'text': ResKey.normal.tr, 'color': 'cl-success'},
      // 1: {'text': '总电压过压三级报警', 'color': 'cl-error'},
      // 2: {'text': '总电压欠压三级报警', 'color': 'cl-error'},
      // 3: {'text': '单体过压三级报警', 'color': 'cl-error'},
      // 4: {'text': '单体欠压三级报警', 'color': 'cl-error'},
      // 5: {'text': '放电电流过大三级报警', 'color': 'cl-error'},
      // 6: {'text': '充电电流过大三级报警', 'color': 'cl-error'},
      // 7: {'text': '放电电池过温三级报警', 'color': 'cl-error'},
      // 8: {'text': '放电电池欠温三级报警', 'color': 'cl-error'},
      // 9: {'text': '充电电池过温三级报警', 'color': 'cl-error'},
      // 10: {'text': '充电电池欠温三级报警', 'color': 'cl-error'},
      // 11: {'text': '绝缘阻值过低三级报警', 'color': 'cl-error'},
      // 12: {'text': '极柱温度过高三级报警', 'color': 'cl-error'},
      // 13: {'text': '高压箱连接器温度过高三级报警', 'color': 'cl-error'},
      // 14: {'text': '单体压差三级报警', 'color': 'cl-error'},
      // 15: {'text': '单体温差三级报警', 'color': 'cl-error'},
      // 16: {'text': 'SOC低三级报警', 'color': 'cl-error'},
    };
    var result = valueArr.isNotEmpty
        ? valueArr[0] == 0
            ? map[valueArr[0]]!['text']
            : ResKey.alarm.tr
        : '';

    return result!;
  }

  static String closeSelfDevelopFormat(int value) {
    final map = {
      0: ResKey.close.tr,
      1: ResKey.open.tr,
    };
    return map[value] ?? '';
  }

  static String closeFormat(value) {
    int status;
    if (value is String) {
      var valueArr = FuncUtils.strToArray(value);
      status = valueArr[0];
    } else {
      status = value;
    }

    var map = {
      '0': ResKey.thingsBreak.tr, // 断开,
      '1': ResKey.thingsClose.tr, //'闭合',
    };
    return map[status.toString()] ?? '';
  }

  static String doorFormat(int value) {
    var map = {
      0: ResKey.thingsCloseDoor.tr, //"关门",',
      1: ResKey.thingsOpenDoor.tr, //"开门",',
    };
    return map[value] ?? '';
  }

  static String openCloseFormat(int status) {
    final map = {
      0: ResKey.close.tr,
      1: ResKey.thingsOpenAction.tr //'打开',
    };
    return map[status] ?? '';
  }

  static String booleanFormat(int status) {
    var map = {
      0: ResKey.thingsNo.tr, // '否',
      1: ResKey.thingsYes.tr, //'是',
    };
    return map[status] ?? '';
  }

  static String openFormat(status) {
    final map = {
      '0': ResKey.close.tr,
      '1': ResKey.open.tr,
    };
    return map[status.toString()] ?? ' ';
  }

  static String inverterStatusFormate(value) {
    String val = '';
    if (value is num) {
      val = value.toStringAsFixed(0);
    } else if (value is String) {
      val = num.parse(value).toStringAsFixed(0);
    }

    const map = {
      '0': '待机:初始化',
      '1': '待机:绝缘阻抗检测',
      '1025': '电网调度：cosψ-P曲线',
      '1026': '电网调度：Q-U曲线',
      '1280': '点检就绪',
      '1281': '点检中',
      '1536': '巡检中',
      '1792': 'AFCI自检',
      '2': '待机:光照检测',
      '2048': 'IV扫描中',
      '2304': '直流输入检测',
      '256': '启动',
      '3': '待机:电网检测',
      '40960': '待机：无光照',
      '45056': '通信断链(SmartLogger写入)',
      '49152': '载入中(SmartLogger写入)',
      '512': '并网',
      '513': '并网:限功率',
      '514': '并网:自降额',
      '768': '关机:异常关机',
      '769': '关机:指令关机',
      '770': '关机:OVGR',
      '771': '关机:通信断链',
      '772': '关机:限功率',
      '773': '关机:需手动开机',
      '774': '关机:直流开关断开'
    };
    return map[val] ?? '';
  }

  static String timeFormat(value) {
    if (value == null) {
      return '';
    } else if (value is String) {
      // Log.d('value==' + value.toString());
      return DateTime.parse(value).format(TimeFormated.dateTimeFromated);
    } else if (value is double) {
      return DateTime.fromMillisecondsSinceEpoch(value.toInt())
          .format(TimeFormated.dateTimeFromated);
    }
    return '';
  }

  static String workFormat(int value) {
    final map = {
      0: ResKey.thingsHalt.tr, //  '停机',
      1: ResKey.alarm.tr,
      2: ResKey.thingsRun.tr, //运行',
    };
    return map[value] ?? '';
  }

  static String chargeFormat(int status) {
    var map = {
      0: ResKey.thingsStewing.tr, //静置,
      1: ResKey.thingsDischarge.tr, //放电ey.thingDischarge.tr, //放电,
      2: ResKey.thingsCharge.tr, //充电,
    };
    return map[status] ?? '';
  }

  static String faultFormat(value) {
    var key;
    if (value is String) {
      var arr = FuncUtils.strToArray(value);
      key = value.isNotEmpty ? arr[0] : -1;
    } else {
      key = value;
    }
    final map = {'0': ResKey.normal.tr, '1': ResKey.alarm.tr};
    return map[value.toString()] ?? '';
  }

  static String airsetFormat(int status) {
    var map = {
      0: ResKey.thingsUnitShutdown.tr, // '机组关闭',
      1: ResKey.thingsUnitStart.tr, //'机组开启',
      2: ResKey.thingsUnitStandby.tr, // '机组待机',
      3: ResKey.thingsUnitLock.tr, //'机组锁定',
      4: ResKey.thingsRemoteShutdown.tr, // '远程关闭',
    };
    return map[status] ?? '';
  }

  static String converterOperatingModeFormat(value) {
    var map = {
      '0': ResKey.thingsOffGridWork.tr,
      '1': ResKey.thingsGridConnectionWork.tr,
      '2': ResKey.thingsMainsCharging.tr
    };
    return map[value.toString()] ?? '';
  }

  static String converterSelfDevelopWorkingStatusFormat(value) {
    final map = {
      '0': ResKey.thingsFiring.tr,
      '1': ResKey.thingsStandby.tr, //'待机',
      '2': ResKey.thingsCease.tr,
      '3': ResKey.thingsEmergencyStop.tr
    };
    return map[value.toString()] ?? '';
  }

  static String converterWorkingStatusFormat(value) {
    final map = {
      '0': ResKey.normal.tr,
      '1': ResKey.thingsStandby.tr, //'待机',
      '2': ResKey.thingsCease.tr,
      '3': ResKey.thingsEmergencyStop.tr
    };
    return map[value.toString()] ?? '';
  }

  static String batteryPackOperatingModeFormat(value) {
    final map = {
      '0': ResKey.normal.tr,
      '1': ResKey.thingsNuclearCapacity.tr, // '核容',
      '2': ResKey.thingsBalanced.tr, // '均衡',
      '3': ResKey.thingsCharge.tr, //充电ey.thingCharge.tr, //充电,
      '4': ResKey.thingsDischarge.tr, //放电,
      '5': ResKey.thingsStewing.tr, //静置
    };
    return map[value.toString()] ?? '';
  }

  static String batteryPackWorkingStatusFormat(value) {
    final map = {
      '0': ResKey.thingsFiring.tr,
      '1': ResKey.thingsStandby.tr, //'待机',
      '2': ResKey.thingsCease.tr
    };
    return map[value.toString()] ?? '';
  }

  static String storageRunFormat(int status) {
    const map = {'0': '削峰填谷', '1': '备电', '2': '手动控制'};
    return map[status.toString()] ?? '';
  }

  static String alarmFormat(value) {
    int val = -1;
    if (value is String) {
      var valueArr = FuncUtils.strToArray(value);
      if (valueArr.isNotEmpty) {
        val = valueArr[0];
      }
    } else if (value is int) {
      val = value;
    } else if (value is DeviceAlarmStatus) {
      return value.label;
    }
    final map = {'0': ResKey.normal.tr, '1': ResKey.alarm.tr};
    return map[val.toString()] ?? '';
  }

  static String alarmArrFormat(value) {
    int val = -1;
    if (value is String) {
      var valueArr = FuncUtils.strToArray(value);
      if (valueArr.isNotEmpty) {
        val = valueArr[0];
      }
    } else if (value is int) {
      val = value;
    }
    var map = {
      '0': 'things.normal'.tr, //正常
      '1': 'things.alarm'.tr, //告警
    };
    return map[val.toString()] ?? '';
  }

  static String airAlarmFormat(value) {
    int val = -1;
    if (value is String) {
      var valueArr = FuncUtils.strToArray(value);
      if (valueArr.isNotEmpty) {
        val = valueArr[0];
      }
    } else if (value is int) {
      val = value;
    }

    final map = {
      0: {'text': ResKey.normal.tr, 'color': 'cl-success'},
      // 1: {'text': '回风温度传感器故障告警', 'color': 'cl-error'},
      // 2: {'text': '回风湿度传感器故障告警', 'color': 'cl-error'},
      // 3: {'text': '送风温度传感器故障告警', 'color': 'cl-error'},
      // 4: {'text': '高温告警', 'color': 'cl-error'},
      // 5: {'text': '低温告警', 'color': 'cl-error'},
      // 6: {'text': '高湿告警', 'color': 'cl-error'},
      // 7: {'text': '低湿告警', 'color': 'cl-error'},
      // 8: {'text': '高压告警', 'color': 'cl-error'},
      // 9: {'text': '高压锁定告警', 'color': 'cl-error'},
      // 11: {'text': '低压锁定告警', 'color': 'cl-error'},
      // 10: {'text': '低压告警', 'color': 'cl-error'},
      // 12: {'text': '冷凝温度传感器故障告警', 'color': 'cl-error'},
      // 13: {'text': '蒸发温度传感器故障告警', 'color': 'cl-error'},
      // 14: {'text': '冷凝高温告警', 'color': 'cl-error'},
      // 15: {'text': '蒸发低温告警', 'color': 'cl-error'},
    };
    var result = val > -1 ? (map[val]?['text'] ?? ResKey.alarm.tr) : '';
    return result;
  }

  static String electricModelFormat(int value) {
    final map = {
      0: ResKey.thingsBatteryConstantVoltage.tr,
      1: ResKey.thingsGridConnectedConstantCurrent.tr,
      2: ResKey.thingsBatteryConstantCurrent.tr,
    };
    return map[value] ?? '';
  }

  static String abnormalFormat(value) {
    int val = -1;
    if (value is String) {
      var valueArr = FuncUtils.strToArray(value);
      if (valueArr.isNotEmpty) {
        val = valueArr[0];
      }
    } else if (value is int) {
      val = value;
    }

    final map = {
      0: {'text': ResKey.normal.tr, 'color': 'cl-success'},
    };
    var result = val == -1
        ? val == 0
            ? map[0]!['text']
            : ResKey.alarm.tr
        : '';

    return result!;
  }

  static String converterFormat(int value) {
    var map = {
      '0': ResKey.thingsOffGridWork.tr,
      '1': ResKey.thingsGridConnectionWork.tr,
      '2': ResKey.thingsMainsCharging.tr,
    };
    return map[value.toString()] ?? '';
  }

  static String converterStauesFormat(int value) {
    final map = {
      '0': ResKey.thingsFiring.tr,
      '1': ResKey.thingsStandby.tr, //'待机',
      '2': ResKey.thingsCease.tr,
      '3': ResKey.thingsReset.tr,
    };
    return map[value.toString()] ?? '';
  }

  static String batteryWorkFormat(int value) {
    final map = {
      '0': ResKey.normal.tr,
      '1': ResKey.thingsNuclearCapacity.tr, //'核容',
      '2': ResKey.thingsBalanced.tr, //  '均衡',
      '3': ResKey.thingsCharge.tr, //充电,
      '4': ResKey.thingsDischarge.tr, //放电,
    };
    return map[value.toString()] ?? '';
  }

  static String batteryWorkingStatusFormat(int value) {
    final map = {
      '0': ResKey.thingsFiring.tr,
      '1': ResKey.thingsStandby.tr, //'待机',
      '2': ResKey.thingsCease.tr,
    };
    return map[value.toString()] ?? '';
  }

  /// 预警级别
  static String fireFightingWarningLevelFormat(int value) {
    var map = {
      '0': ResKey.thingsTheSystemIsNormal.tr, //系统正常
      '3': ResKey.thingsLevel1Warning.tr, // '一级预警',
      '4': ResKey.thingsLevel2Warning.tr, //  '二级预警',
    };
    return map[value.toString()] ?? '';
  }

  /// 故障类型
  static String fireFightingFaultTypeFormat(int value) {
    var map = {
      '0': ResKey.thingsNoFault.tr, // '无故障'
      '1': ResKey
          .thingsBIESActivatedFireExtinguisherActivated.tr, //'BIES已启动（灭火器启动）'
      '2': ResKey.thingsCAN1CommunicationFailure.tr, //   'CAN1通讯故障',
      '3': ResKey.thingsSuppressionDeviceMalfunction.tr, // '抑制装置故障',
      '4': ResKey.thingsDetectorFailure.tr, //  '探测器故障（包括单箱离线故障和探测器本身故障）',
    };
    return map[value.toString()] ?? '';
  }

  /// 启动类型
  static String fireFightingStartupTypeFormat(int value) {
    const map = {
      '3': '自动：火情2级，探测器自检测启动；',
      '4': '手动：强制控制，上级设备控制启动',
    };
    return map[value.toString()] ?? '';
  }

  /// 子阀门状态
  static String fireFightingSubValveStatusFormat(int value) {
    const map = {
      '0': '子阀关闭',
      '1': '子阀打开',
    };
    return map[value.toString()] ?? '';
  }

  static String clusterFormatint(int value) {
    return value == 0
        ? ResKey.thingsBreak.tr
        : ResKey.thingsClose.tr; //// 断开:'闭合';
  }

  static parallelGridFormat(value) {
    var map = {
      '0': ResKey.thingsGridConnection.tr, //并网
      '1': ResKey.thingsOffGrid.tr, //离网
    };

    return map[value.toString()] ?? '';
  }

  static String powerFormat(value) {
    if (value == null) {
      return '--';
    }
    return FuncUtils.getValueWithUnit(
        double.parse(value.toString()).toStringAsFixed(2), 'kW');
  }

  static String kWpFormat(value) {
    return FuncUtils.getValueWithUnit(
        double.parse(value.toString()).toStringAsFixed(2), 'kWp');
  }

  static String noPowerFormat(value) {
    return FuncUtils.getValueWithUnit(
        double.parse(value.toString()).toStringAsFixed(2), 'kvar');
  }

  static String powerHourFormat(value) {
    return FuncUtils.getValueWithUnit(
        double.parse(value.toString()).toStringAsFixed(2), 'kWh');
  }

  static String noPowerHourFormat(value) {
    return FuncUtils.getValueWithUnit(
        double.parse(value.toString()).toStringAsFixed(2), 'kvar·h');
  }

  static String voltageFormat(value) {
    return FuncUtils.getValueWithUnit(
        double.parse(value.toString()).toStringAsFixed(2), 'V');
  }

  static String kVoltageFormat(value) {
    return FuncUtils.getValueWithUnit(
        double.parse(value.toString()).toStringAsFixed(2), 'kV');
  }

  static String kVAFormat(value) {
    return FuncUtils.getValueWithUnit(
        double.parse(value.toString()).toStringAsFixed(2), 'kVA');
  }

  static String currentFormat(value) {
    return FuncUtils.getValueWithUnit(
        double.parse(value.toString()).toStringAsFixed(2), 'A');
  }

  static String frequencyFormat(value) {
    return FuncUtils.getValueWithUnit(
        double.parse(value.toString()).toStringAsFixed(2), 'HZ');
  }

  static String tempFormat(value) {
    return FuncUtils.getValueWithUnit(
        double.parse(value.toString()).toStringAsFixed(2), '℃');
  }

  static String unitTempFormat(value) {
    return FuncUtils.getValueWithUnit(
        double.parse(value.toString()).toStringAsFixed(3), '℃');
  }

  static String tempSigleFormat(value) {
    return FuncUtils.getValueWithUnit(
        double.parse(value.toString()).toStringAsFixed(3), '℃');
  }

  static String percentageFormat(value) {
    return FuncUtils.getValueWithUnit(value, '%');
  }

  static String kohmFormat(value) => FuncUtils.getValueWithUnit(
      double.parse(value.toString()).toStringAsFixed(2), 'kΩ');

  static String hydrogenFormat(value) =>
      FuncUtils.getValueWithUnit(value, 'ppm');

  static String ralateHumidityFormat(value) =>
      FuncUtils.getValueWithUnit(value, '%rh');
}
